package org.lvgo.proxy.image;

/**
 * @author lvgo
 * @version 1.0
 * @Description: 实际图片的代理
 * @date 18-8-23 上午11:04
 */
public class ProxyImage implements Image {

    private String name;
    private RealImage realImage;


    public ProxyImage(String name) {
        this.name = name;
    }

    /**
     * 展示图片
     * <p>
     * 通过代理,增加了对磁盘的访问控制
     */
    @Override
    public void display() {
        if (realImage == null) {
            realImage = new RealImage(name);
        }
        realImage.display();
    }
}
